proc report_logic_depth {timing_path} {
	set rtl_logic_depth [get_property $timing_path num_cell_arcs]
	set repeater_logic_depth [sizeof [get_cells -of_objects  [get_property [get_property $timing_path timing_points] pin] -filter "ref_name =~ BUFF* || ref_name =~ INV*"]]
	set slack [get_property $timing_path slack]
	set skew  [get_property $timing_path skew]
	set period [get_property $timing_path period]
	set dly_tbl [get_property  [get_property $timing_path timing_points] delay]
	set index 0;set dly 0;
	foreach cc [get_property [get_cells -of_objects  [get_property  [get_property $timing_path timing_points] pin] ] ref_lib_cell_name] {
	if {[string match  "BUF*" $cc] || [string match  "INV*" $cc]} {
		set dly [expr $dly + [lindex $dly_tbl [expr $index * 2]] +  [lindex $dly_tbl [expr $index * 2 + 1]]]
	}	
		incr index
}
		
	return "period:\t\t\t$period\nskew:\t\t\t$skew\nslack:\t\t\t$slack\nrtl_logic_depth:\t\t$rtl_logic_depth\nrepeater_logic_depth:\t\t$repeater_logic_depth\ntotal_repeater_delay:\t\t$dly"
}

define_proc_arguments report_logic_depth \
	-info "Return the RTL logic depth and Repeater logic level of one timing path"

alias rld report_logic_depth


